home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-07 | 1.4 KB | 82 lines | [TEXT/DWat] |
- % Plot a hyperpola with asyptotes
- % You can alter the a and b values for the parabola
- set a 1
- set b 1
-
- % Find the focus
- set c a a * b b * + sqrt
- npts 100
- graphlimits -3 a * 3 a * -3 a * 3 a *
- graphframe 1 6 1 6
- fullscreen yes
- fontname times
- fontsize 10
-
- % Calculate the Hyperbola in each quadrant
- % and plot as a blue line
- pensize 2
- pencolor blue
- xrange a xright
- rpn <x dup * a dup * / 1 - b dup * * sqrt >y
- plotline
- % Flip it about the x axis to draw the
- % other half of the curve
- rpn <y -1 * >y
- plotline
-
- xrange "a -1 *" xleft
- rpn <x dup * a dup * / 1 - b dup * * sqrt >y
- plotline
- rpn <y -1 * >y
- plotline
-
- % Draw the asymptotes to the hyperbola
- cliptoframe false
- pencolor red
- pensize 1
- moveto xleft xleft b * a /
- drawto xright xright b * a /
- moveto xleft xleft b * a / -1 *
- drawto xright xright b * a / -1 *
- pensize 0.25
- pencolor black
-
- % Draw some labels
- moveto xleft 0
- drawarrowto xright 0
- moveto 0 ybottom
- drawarrowto 0 ytop
-
- cliptoframe false
- moveto 0 ytop 1.05 *
- drawlabel 8 \iy
- moveto xright 1.05 * 0
- drawlabel 6 \ix
-
- % Draw some lines to show x = -1 and x = +a
- pencolor 50 50 50 % 50% gray
- pendash 2
- set n npts xright a / / int
- moveto c -1 * 0
- drawto x(n) y(n)
- drawto c 0
-
- moveto x(n) y(n)
- drawlabel 4 \iP(\ix,\iy)
- moveto c -1 * .05
- drawlabel 8 \iF\d1(-\ic,0)
- moveto c .05
- drawlabel 8 \iF\d2(\ic,0)
-
- pendash solid
- moveto a -1 * ybottom
- drawto a -1 * ytop .9 *
- drawlabel 8 \ix = -\ia
-
- moveto a ybottom
- drawto a ytop .9 *
- drawlabel 8 \ix = -\ia
-
- close xrange
-
-